home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earcd / grafica / amhelios / ff_scan.h < prev    next >
C/C++ Source or Header  |  1999-01-01  |  3KB  |  102 lines

  1. ////////////////////////////////////////////////////////////
  2. //
  3. //  FF_SCAN.H - Form Factor Scan Conversion Class
  4. //
  5. //  Version:    1.03A
  6. //
  7. //  History:    94/08/23 - Version 1.00A release.
  8. //              94/12/16 - Version 1.01A release.
  9. //              95/02/05 - Version 1.02A release.
  10. //              95/07/21 - Version 1.02B release.
  11. //              96/02/14 - Version 1.02C release.
  12. //              96/04/01 - Version 1.03A release.
  13. //
  14. //  Compilers:  Microsoft Visual C/C++ Professional V1.5
  15. //              Borland C++ Version 4.5
  16. //
  17. //  Author:     Ian Ashdown, P.Eng.
  18. //              byHeart Software Limited
  19. //              620 Ballantree Road
  20. //              West Vancouver, B.C.
  21. //              Canada V7S 1W3
  22. //              Tel. (604) 922-6148
  23. //              Fax. (604) 987-7621
  24. //
  25. //  Copyright 1994-1996 byHeart Software Limited
  26. //
  27. //  The following source code has been derived from:
  28. //
  29. //    Ashdown, I. 1994. Radiosity: A Programmer's
  30. //    Perspective. New York, NY: John Wiley & Sons.
  31. //
  32. //  It may be freely copied, redistributed, and/or modified
  33. //  for personal use ONLY, as long as the copyright notice
  34. //  is included with all source code files.
  35. //
  36. ////////////////////////////////////////////////////////////
  37.  
  38. #ifndef _FF_SCAN_H
  39. #define _FF_SCAN_H
  40.  
  41. #include "ff_scan.h"
  42. #include "ff_poly.h"
  43.  
  44. static const float FF_Infinity = MAX_VALUE;
  45. static const WORD FF_None = 0;
  46.  
  47. struct FormCellInfo     // Face cell information
  48. {
  49.   float depth;          // Polygon cell depth
  50.   WORD id;              // Polygon identifier
  51. };
  52.  
  53. struct FormVertexInfo   // Vertex information
  54. {
  55.   struct                // Face cell array offsets
  56.   {
  57.     int x;              // Width offset
  58.     int y;              // Height offset
  59.   }
  60.   face;
  61.   Point3 posn;          // Scaled position
  62. };
  63.  
  64. struct FormScanInfo     // Scan line intersection info
  65. {
  66.   double x;             // X-axis co-ordinate
  67.   double z;             // Pseudodepth
  68. };
  69.  
  70. struct FormEdgeInfo     // Edge information
  71. {
  72.   BOOL first;               // First intersection flag
  73.   FormScanInfo isect[2];    // Scan line intersection array
  74. };
  75.  
  76. // Form factor polygon scan conversion (abstract class)
  77. class FormScan
  78. {
  79.   protected:
  80.     BOOL status;                // Object status
  81.     int ymin;                   // Minimum y-axis co-ord
  82.     int ymax;                   // Maximum y-axis co-ord
  83.     int num_vert;               // Number of vertices
  84.     FormCellInfo **cell_buffer; // Cell info buffer ptr
  85.     FormEdgeInfo *edge_list;    // Edge list pointer
  86.     FormVertexInfo v_info[8];   // Vertex info table
  87.     WORD poly_id;               // Polygon identifier
  88.  
  89.     virtual void DrawEdgeList() = 0;
  90.     void GetVertexInfo( FormPoly & );
  91.     void ScanEdges();
  92.  
  93.   public:
  94.     virtual ~FormScan() { };
  95.  
  96.     BOOL GetStatus() { return status; }
  97.     void Scan( FormPoly & );
  98. };
  99.  
  100. #endif
  101.  
  102.